<?php

namespace App\Http\Controllers\Api;

use App\Model\ChatFriend;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class ChatFriendController extends BaseController
{
   protected $chat_friend_baseinfo_model;//资料提交数据

    public function __construct()
    {
       $this->chat_friend_baseinfo_model = new ChatFriend();
    }
    /**
     * 主播交友卡片资料申请记录
     */
    public function getChatFriendList(Request $request)
    {
        $page = $request->get('page',1);
        $limit = $request->get('limit',10);
        $status = $request->get('status',0);//1=审核通过 0=未审核 2=审核驳回
        $user_id = $request->get('user_id',0);//用户id
        //获取数据
        $res = $this->chat_friend_baseinfo_model->getChatFriendList($page, $limit, $status, $user_id );
    
        return $this->toJson(self::SUCCESS, $res);
    }

    //更改审核状态
    public function chageStatus(Request $request){
        $id = $request->get('id',0);//审核id
        $status = $request->get('status',0);//1=审核通过 0=未审核 2=审核驳回
        if(empty($id)){
            return $this->toJson(self::PARAM_ERROR); 
        }
        $res = $this->chat_friend_baseinfo_model->chageStatus($id,$status);
        return $this->toJson(self::SUCCESS, $res);
    }
}


